  {  Petrova Tatjana
     2012 / 10 / 14
     This program counts common points of the lines.}

program Lines;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  fin :textfile;
  N,a,c,b,a1,c1,b1,a2,c2,b2,j,g,g1,d,w,i,x1,y1,s,h,v,l,x2,y2,x3,y3,x4,y4 :integer;
  x,y,e,f:real;

begin
  assignFile(fin, 'input.txt');
  reset(fin);
  readln(fin,N);
  for i:= 1 to (N-1) do
    for j:= 1 to (N-1) do
    begin
      if (i=1) then
        readln(fin,x1,y1,x2,y2)
      else begin
        x1:=s;
        y1:=h;
        x2:=v;
        y2:=l;
      end;

      c1:=x1*y2-x2*y1;
      b1:=x2-x1;
      a1:=y1-y2;
      readln(fin,x3,y3,x4,y4);
      c2:=x3*y4-x4*y3;
      b2:=x4-x3;
      a2:=y3-y4;
      g:=c2*b1-c1*b2 ;
      d:=a1*c2-a2*c1;
      g1:=a1*b2-a2*b1;
      if (j=i+1) then
      begin
        s:=x1;
        h:=y1;
        v:=x2;
        l:=y2;
      end;

      if (g1<>0) and (j<>1)then
      begin
        w:=w+1;
        x:=(g mod g1) + (g div g1);
        y:=(d mod g1) + (d div g1);
        if(e=x)and(y=f)and(N<>2) then
          w :=w-1;
      end;
      e:=x;
      f:=y;
      x:=0;
      y:=0;
    end;
  writeln(w);
  readln;
  closeFile(fin);

end.
